/*----------------------------------------------------------------
 * \file        ct_voip_msg_pool.h
 * \author      lilian lilian@hujiang.com
 * \date        2014/08/08
 * \brief
 *      memory pool for ctVOIPMsg.
 *----------------------------------------------------------------*/
#ifndef CTVOIP_MSGPOOL_H_
#define CTVOIP_MSGPOOL_H_

#include <deque>
#include "ctSingleton.h"
#include "ct_mutex.h"

class ctVOIPMsg;
class ctVOIPMsgPool : public Singleton<ctVOIPMsgPool> {
public:
        ctVOIPMsgPool();
        ~ctVOIPMsgPool();

        ctVOIPMsg*	fetch();
        void	        free(ctVOIPMsg* msg);

public:
        static const unsigned int MSG_POOL_SIZE = 1000; //TODO
private:
        std::deque<ctVOIPMsg*>	msg_queue_;
        ctMutex                 mutex_;
};

#endif //CTVOIP_MSGPOOL_H_
